/*
 * Copyright (c) 2024 Huawei Device Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef MYAPPLICATION_TEST_BASE_H
#define MYAPPLICATION_TEST_BASE_H

#include <vector>

#include <native_drawing/drawing_bitmap.h>
#include <native_drawing/drawing_canvas.h>

#define DEFAULT_WIDTH 720
#define DEFAULT_HEIGHT 1080
#define DEFAULT_BACKGROUND_COLOR 0xFFFFFFFF

class TestBase {
public:
    TestBase() = default;
    virtual ~TestBase() = default;

    OH_Drawing_Bitmap* GetBitmap()
    {
        return bitmap_;
    }

    uint32_t TestPerformance(uint32_t testCount);
 
protected:
    static constexpr float START_X = 100;              // 绘制文字的起始X坐标
    static constexpr float START_Y = 100;              // 绘制文字的起始Y坐标
    static constexpr uint32_t FONT_COLOR = 0xFF0000FF; // 默认绘制蓝色文字

    virtual void OnTestPerformance() = 0;
    size_t GetUtf8CharLength(const char* utf8Char);

    std::vector<const char*> text_; // 要绘制的字符串
    OH_Drawing_Canvas* canvas_ = nullptr;

private:
    void CreateBitmapCanvas();

    OH_Drawing_Bitmap* bitmap_ = nullptr;
};

#endif //MYAPPLICATION_TEST_BASE_H
